﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tools;

namespace Common.Exceptions
{
    public class EmptyArgumentException : IncorrectArgumentException
    {
        public EmptyArgumentException(string argumentName)
            : base(argumentName)
        {
            Code = ExceptionHelper.excode_empty_argument;
            DefaultMessage = "Argument can not be empty";
        }

        public EmptyArgumentException(string argumentName, string methodName)
            : this(argumentName)
        {
            MethodName = methodName;
        }

        public override void Prepare()
        {
            if (StringHelper.IsVeryEmpty(MethodName))
                MethodName = TargetSite.Name;
        }
    }
}
